﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_OrderManagement : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadOrder();
        }
    }
    private void loadOrder()
    {
        ChoDienTuDataContext cdt = new ChoDienTuDataContext();
        grvOrder.DataSource = cdt.Select_AllOrder();
        grvOrder.DataBind();
        lblNum.Text = cdt.Select_AllOrder().Count().ToString() + " orders";
    }
    protected void grvOrder_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        ChoDienTuDataContext cdt = new ChoDienTuDataContext();
        grvOrder.DataSource = cdt.Select_AllOrder();
        grvOrder.PageIndex = e.NewPageIndex; 
        grvOrder.DataBind();
    }
}